<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>opp</title>
    </head>

<body>
<?php
/**php知识点练习**/
class ShopProduct {
	private $cost = 100;
	public $name = 'BB';
	public $price = 100;
	protected $sell = 2;


/**定义构造方法，通常用来进行对象初始化工作**/

public function_contruct($name='',$price='0',$cost = '0',$sell = '0')
	{
		$this ->name=$name;
		$this->cost = $cost;
		$this->price = $price ;
		$this->sell  = $sell ;

	}
	/**定义方法**/
	public function display($name,$price,$cost,$sell)
	{
		return $this->name.'的价格是：'. this->price;
	}
}

//定义书籍类
/**
 * 书籍类
 */
classBook extends ShopProduct{
	public $author =' ';
	public $version =' ';
	public $press =' ';

	function__construct($name='',$price='0',$cost = '0',$sell = '0',$author =' ',$version =' ',$press =' ')
	}

/**对象的生成**/
$p1 = new ShopProduct();
$p1 = new ShopProduct('小米6'，2999,2000,2000);

$p3=new Book('PHP核心语法',30.00,3.0,100,'john',1)
var_dump( $p1->cost );
var_dump( $p1->name );
var_dump( $p1->sell);
/**访问类的属性**/
echo '<pre>';


?>

</body>

</html>